const app = Vue.createApp({ data() { return { counter: 0, name: "", cognome: "", nometot: "", }; }, watch: { // name(value){ // if (this.name === ''){ // this.nometot = ''; // } // this.nometot = value + " Cognome"; // } }, computed: { fullname() { if (this.name === "" || this.cognome === "") { return ""; } return this.name + " " + this.cognome; }, }, methods: { // outputFullname() { // if (this.name === "" || this.cognome === "") { // return ""; // } // return this.name + " " + this.cognome; // }, setName(event, lastName) { this.name = event.target.value; //+ ' ' + lastName; }, add(num) { this.counter = this.counter + num; }, reduce(num) { this.counter = this.counter - num; // this.counter--; }, resetInput() { this.name = ""; this.cogome = ""; }, }, }); app.mount("#events");